<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>32-构造函数和原型对象的this指向</title>
</head>
<body>
    <script>
        // 1. 构造函数this指向 实例对象
        function Person(name, age) {
            this.name = name
        }

        // 2. 原型对象this指向 实例对象
        Person.prototype.sayHi = function() {
            console.log('你好')
            console.log(this) // 指向实例对象 zs  {name: '张三'}
        }

        const zs = new Person('张三')
        zs.sayHi()
        
    </script>
</body>
</html>